<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>百度一下，你就知道</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
        }
        
        body {
            background: #f8f9fa;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            color: #202124;
            background: linear-gradient(135deg, #f5f7fa 0%, #e4edf5 100%);
        }
        
        header {
            display: flex;
            justify-content: flex-end;
            padding: 20px 30px;
            align-items: center;
            background: rgba(255, 255, 255, 0.8);
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
        }
        
        .nav-links {
            display: flex;
            gap: 20px;
            align-items: center;
        }
        
        .nav-links a {
            text-decoration: none;
            color: #5f6368;
            font-size: 14px;
            padding: 8px 12px;
            border-radius: 4px;
            transition: all 0.3s;
        }
        
        .nav-links a:hover {
            background-color: #f1f3f4;
            color: #1a73e8;
        }
        
        .main-content {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 20px;
            margin-top: -60px;
        }
        
        .logo {
            margin-bottom: 30px;
            text-align: center;
            position: relative;
        }
        
        .logo-text {
            font-size: 80px;
            font-weight: 700;
            letter-spacing: -3px;
            color: #2932e1;
            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
            position: relative;
            z-index: 2;
        }
        
        .logo-bg {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 150px;
            height: 150px;
            background: linear-gradient(135deg, #e3eeff 0%, #f9e6ff 100%);
            border-radius: 50%;
            z-index: 1;
            opacity: 0.7;
            filter: blur(20px);
        }
        
        .search-container {
            width: 100%;
            max-width: 584px;
            position: relative;
            margin-bottom: 30px;
            z-index: 10;
        }
        
        .search-box {
            width: 100%;
            height: 46px;
            border-radius: 24px;
            border: 1px solid #dfe1e5;
            padding: 0 20px 0 50px;
            font-size: 16px;
            outline: none;
            box-shadow: 0 1px 6px rgba(32, 33, 36, 0.1);
            transition: all 0.3s ease;
            background: white;
        }
        
        .search-box:hover, .search-box:focus {
            box-shadow: 0 1px 10px rgba(32, 33, 36, 0.2);
            border-color: rgba(223, 225, 229, 0);
        }
        
        .search-icon {
            position: absolute;
            left: 18px;
            top: 50%;
            transform: translateY(-50%);
            color: #9aa0a6;
            font-size: 16px;
        }
        
        /* 搜索建议样式 */
        .suggestions-container {
            position: absolute;
            top: 100%;
            left: 0;
            width: 100%;
            background: white;
            border-radius: 0 0 8px 8px;
            box-shadow: 0 4px 6px rgba(32,33,36,0.28);
            margin-top: 4px;
            z-index: 100;
            max-height: 300px;
            overflow-y: auto;
            display: none;
        }
        
        .suggestion-item {
            padding: 10px 20px 10px 50px;
            font-size: 16px;
            color: #202124;
            cursor: pointer;
            display: flex;
            align-items: center;
            transition: background-color 0.2s;
            position: relative;
        }
        
        .suggestion-item:before {
            content: "🔍";
            position: absolute;
            left: 20px;
            top: 50%;
            transform: translateY(-50%);
            color: #9aa0a6;
            font-size: 14px;
        }
        
        .suggestion-item:hover, .suggestion-item.active {
            background-color: #f8f9fa;
        }
        
        .suggestion-item .highlight {
            font-weight: bold;
            color: #2932e1;
        }
        
        .search-buttons {
            display: flex;
            justify-content: center;
            gap: 12px;
            margin-top: 20px;
        }
        
        .search-btn {
            background: #f8f9fa;
            border: 1px solid #f8f9fa;
            border-radius: 24px;
            color: #3c4043;
            padding: 10px 24px;
            font-size: 14px;
            cursor: pointer;
            transition: all 0.3s;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
        }
        
        .search-btn:hover {
            box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
            border: 1px solid #dadce0;
            background: #f8f9fa;
        }
        
        .search-btn.primary {
            background: #2932e1;
            color: white;
            border: 1px solid #2932e1;
        }
        
        .search-btn.primary:hover {
            background: #1b24c9;
            box-shadow: 0 1px 5px rgba(41, 50, 225, 0.3);
        }
        
        .stats {
            margin-top: 20px;
            color: #5f6368;
            font-size: 14px;
        }
        
        .features {
            display: flex;
            gap: 30px;
            margin-top: 40px;
        }
        
        .feature-card {
            background: white;
            border-radius: 12px;
            padding: 20px;
            width: 180px;
            text-align: center;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
            transition: all 0.3s;
        }
        
        .feature-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
        }
        
        .feature-icon {
            font-size: 36px;
            margin-bottom: 15px;
            color: #2932e1;
        }
        
        .feature-name {
            font-size: 16px;
            color: #202124;
            font-weight: 500;
        }
        
        footer {
            background: rgba(255, 255, 255, 0.8);
            padding: 15px 30px;
            color: #70757a;
            font-size: 14px;
            text-align: center;
            margin-top: auto;
            border-top: 1px solid #e8eaed;
        }
        
        .footer-links {
            display: flex;
            justify-content: center;
            gap: 25px;
            margin-bottom: 10px;
        }
        
        .footer-links a {
            color: #5f6368;
            text-decoration: none;
        }
        
        .footer-links a:hover {
            text-decoration: underline;
            color: #2932e1;
        }
        
        @media (max-width: 768px) {
            .logo-text {
                font-size: 60px;
            }
            
            .search-container {
                max-width: 90%;
            }
            
            .features {
                flex-wrap: wrap;
                justify-content: center;
                gap: 15px;
            }
            
            .feature-card {
                width: 140px;
                padding: 15px;
            }
            
            .footer-links {
                flex-wrap: wrap;
                gap: 15px;
            }
        }
    </style>
</head>
<body>
    <header>
        <div class="nav-links">
            <a href="#"><i class="fas fa-newspaper"></i> 新闻</a>
            <a href="#"><i class="fas fa-image"></i> 图片</a>
            <a href="#"><i class="fas fa-video"></i> 视频</a>
            <a href="#"><i class="fas fa-map-marked-alt"></i> 地图</a>
        </div>
    </header>
    
    <main class="main-content">
        <div class="logo">
            <div class="logo-bg"></div>
            <div class="logo-text">百度</div>
        </div>
        
        <div class="search-container">
            <i class="fas fa-search search-icon"></i>
            <input type="text" id="search-input" class="search-box" placeholder="输入关键词搜索...">
            <div class="suggestions-container" id="suggestions-container">
                <!-- 搜索建议将在这里动态显示 -->
            </div>
        </div>
        
        <div class="search-buttons">
            <button class="search-btn primary" id="search-button">百度一下</button>
            <button class="search-btn" id="lucky-button">手气不错</button>
        </div>
        
        <div class="stats">
            百度为您找到相关结果约100,000,000个
        </div>
        
        <div class="features">
            <div class="feature-card">
                <div class="feature-icon">
                    <i class="fas fa-graduation-cap"></i>
                </div>
                <div class="feature-name">百度百科</div>
            </div>
            <div class="feature-card">
                <div class="feature-icon">
                    <i class="fas fa-comments"></i>
                </div>
                <div class="feature-name">百度贴吧</div>
            </div>
            <div class="feature-card">
                <div class="feature-icon">
                    <i class="fas fa-book"></i>
                </div>
                <div class="feature-name">百度知道</div>
            </div>
            <div class="feature-card">
                <div class="feature-icon">
                    <i class="fas fa-shopping-bag"></i>
                </div>
                <div class="feature-name">百度购物</div>
            </div>
        </div>
    </main>
    
    <footer>
        <div class="footer-links">
            <a href="#">关于百度</a>
            <a href="#">使用百度前必读</a>
            <a href="#">隐私条款</a>
            <a href="#">帮助中心</a>
            <a href="#">企业推广</a>
        </div>
        <div class="copyright">
            ©2023 Baidu
        </div>
    </footer>

    <script>
        // DOM元素
        const searchInput = document.getElementById('search-input');
        const suggestionsContainer = document.getElementById('suggestions-container');
        const searchButton = document.getElementById('search-button');
        const luckyButton = document.getElementById('lucky-button');
        
        // 当前选中的建议项索引
        let selectedSuggestionIndex = -1;
        
        // 监听搜索框输入事件
        searchInput.addEventListener('input', function() {
            const query = this.value.trim();
            
            // 清空之前的建议
            suggestionsContainer.innerHTML = '';
            suggestionsContainer.style.display = 'none';
            
            if (query.length > 0) {
                // 模拟发送请求到服务器（实际应用中替换为真实API）
                fetchSuggestions(query);
            }
        });
        
        // 模拟从服务器获取搜索建议
        function fetchSuggestions(query) {
            // 模拟网络延迟
            setTimeout(() => {
                // 这里模拟服务器返回的JSON数据
                const suggestions = generateMockSuggestions(query);
                
                // 显示建议
                displaySuggestions(suggestions);
            }, 300);
        }
        
        // 生成模拟建议数据
        function generateMockSuggestions(query) {
            const baseSuggestions = [
                `${query} 是什么`,
                `${query} 百度百科`,
                `${query} 图片`,
                `${query} 下载`,
                `${query} 官网`,
                `${query} 教程`,
                `${query} 最新`,
                `${query} 价格`
            ];
            
            // 随机打乱顺序
            return baseSuggestions.sort(() => Math.random() - 0.5);
        }
        
        // 显示搜索建议
        function displaySuggestions(suggestions) {
            if (suggestions.length === 0) {
                suggestionsContainer.style.display = 'none';
                return;
            }
            
            suggestionsContainer.innerHTML = '';
            suggestions.forEach((suggestion, index) => {
                const item = document.createElement('div');
                item.className = 'suggestion-item';
                item.textContent = suggestion;
                item.dataset.index = index;
                
                // 高亮显示查询词
                const regex = new RegExp(searchInput.value, 'gi');
                const highlighted = suggestion.replace(regex, match => `<span class="highlight">${match}</span>`);
                item.innerHTML = highlighted;
                
                item.addEventListener('click', function() {
                    searchInput.value = suggestion;
                    performSearch();
                });
                
                suggestionsContainer.appendChild(item);
            });
            
            suggestionsContainer.style.display = 'block';
        }
        
        // 执行搜索
        function performSearch() {
            const searchTerm = searchInput.value.trim();
            if (searchTerm !== '') {
                suggestionsContainer.style.display = 'none';
                // 在实际应用中，这里会跳转到搜索结果页面
                alert(`正在搜索: "${searchTerm}"\n（在实际应用中，这里会跳转到搜索结果页面）`);
            }
        }
        
        // 键盘导航
        searchInput.addEventListener('keydown', function(e) {
            const suggestions = suggestionsContainer.querySelectorAll('.suggestion-item');
            
            if (suggestions.length === 0) return;
            
            switch(e.key) {
                case 'ArrowDown':
                    e.preventDefault();
                    selectedSuggestionIndex = (selectedSuggestionIndex + 1) % suggestions.length;
                    updateSelection(suggestions);
                    break;
                case 'ArrowUp':
                    e.preventDefault();
                    selectedSuggestionIndex = (selectedSuggestionIndex - 1 + suggestions.length) % suggestions.length;
                    updateSelection(suggestions);
                    break;
                case 'Enter':
                    if (selectedSuggestionIndex >= 0 && selectedSuggestionIndex < suggestions.length) {
                        searchInput.value = suggestions[selectedSuggestionIndex].textContent;
                        suggestionsContainer.style.display = 'none';
                        performSearch();
                    } else {
                        performSearch();
                    }
                    break;
                case 'Escape':
                    suggestionsContainer.style.display = 'none';
                    selectedSuggestionIndex = -1;
                    break;
            }
        });
        
        // 更新选中的建议项
        function updateSelection(suggestions) {
            suggestions.forEach((item, index) => {
                if (index === selectedSuggestionIndex) {
                    item.classList.add('active');
                    // 滚动到可见区域
                    item.scrollIntoView({ block: 'nearest', behavior: 'smooth' });
                } else {
                    item.classList.remove('active');
                }
            });
        }
        
        // 点击搜索按钮
        searchButton.addEventListener('click', performSearch);
        
        // 回车键搜索
        searchInput.addEventListener('keypress', function(e) {
            if (e.key === 'Enter') {
                performSearch();
            }
        });
        
        // 手气不错按钮
        luckyButton.addEventListener('click', function() {
            const luckySites = [
                "百度百科",
                "百度知道",
                "百度贴吧",
                "百度地图",
                "百度图片"
            ];
            const randomSite = luckySites[Math.floor(Math.random() * luckySites.length)];
            alert(`手气不错！将带您前往: ${randomSite}\n（在实际应用中，这里会跳转到随机站点）`);
        });
        
        // 点击页面其他区域关闭建议框
        document.addEventListener('click', function(e) {
            if (!searchInput.contains(e.target) && !suggestionsContainer.contains(e.target)) {
                suggestionsContainer.style.display = 'none';
            }
        });
    </script>
</body>
</html>